<template>    
    <div>
        <h1>请登录</h1>
 <button @click="loginOutFunc" v-if="isLogin">退出</button>
        <router-view></router-view>

       
    </div>
</template>


<script setup>
import {useStore} from 'vuex'
import {useRouter} from 'vue-router'
import {computed} from 'vue'
 const router= useRouter()

  const store=useStore()

const loginOutFunc=()=>{

  window.sessionStorage.clear()
  
  store.commit('changeLoginState',false)
  router.push({path:"/login"})
}
 // const tokenStr=window.sessionStorage.getItem("token")

const isLogin=computed(() => store.state.isLogined)

//解耦

// isLogin.value=store.state.isLogined

// console.log('islogin:',isLogin.value)



</script>